package xian.woniuxy.zn_redis;

import java.io.IOException;

class A implements Runnable {

    @Override
    public void run() {
        // 发一个中断信号
        Thread.currentThread().interrupt();
        Thread.currentThread().interrupt();
        System.out.println("开始");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            // throw new RuntimeException(e);
            System.out.println("A error");
        }
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            // throw new RuntimeException(e);
            System.out.println("B error");
        }
        System.out.println("结束");

    }
}

public class App {
    public static void main(String[] args) throws IOException {
        Thread th = new Thread(new A());
        th.start();
    }
}
